<template>
	<view class="weaper">
	    <view class="butomsearch" style="display: none;">
	        <view class="serarchite">
	            <view class="title">产品编号</view>
	            <view class="w22"><input class="inputser" 
	            v-model="goodscode"
	            type="text" placeholder="请输入产品编号"/></view>
	        </view>
	        <view class="serarchite">
	            <view class="title">产品名称</view>
	            <view class=" w22">
	                 <input class="inputser" type="text" 
					  v-model="goodsname"
	                  placeholder="请输入产品名称"/>
	            </view>
	        </view>
	        <view class="searchbtn" @click="search">查询</view>
	    </view>
	    <view class="frmand" v-for="item in datalist" >
	        <view class="itemna">
	          <view class="a1">发货单号：</view>
	          <view class="a2">{{item.order_no}}</view>
	        </view>
	        <view class="itemna">
	          <view class="a1">接收网点：</view>
	          <view class="a2">{{item.wdbh}}</view>
	        </view>
			<view class="itemna">
			  <view class="a1">接收网点名称：</view>
			  <view class="a2">{{item.wdbh_name}}</view>
			</view>
	        <view class="itemna" v-if="item.boxcode && item.boxcode != null">
	          <view class="a1">发货数量（箱）：</view>
	          <view class="a2">{{item.boxcode}} 箱</view>
	        </view>
	        <view class="itemna" v-if="item.sncode">
	          <view class="a1">发货数量（罐）：</view>
	          <view class="a2">{{item.sncode}} 罐</view>
	        </view>
	        <view class="itemna">
	          <view class="a1">发货时间：</view>
	          <view class="a2">{{item.add_time}}</view>
	        </view>
	        <view class="itemna" v-if="item.is_qianshou == 0" style="color: red;">
				<view>签收状态：待签收</view>
				<view @click="chexiaofahuo(item)" class="cebtns">撤销发货</view>
			</view>
	        <view class="itemna" v-if="item.is_qianshou == 1" style="color: #1B764A;">签收状态：已签收</view>
			
	        <view>
	            <view>产品信息如下：</view>
	            <view v-for="items in item.detail" class="lids">
	              <view class="a1">产品料号：{{items.product_code}}</view>
	              <view class="a1">产品名称：{{items.product_name}}</view>
	              <view class="a1">产品数量：{{items.count}} 罐</view>
	            </view>
	        </view>
	    </view>
	    <view class="nodata" v-if="datalist.length == 0">暂无库存明细</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
			  page:1,
			  size:10,
			  batch:"",//批次
			  goodscode:"",//产品编号
			  goodsname:"",//产品名称
			  datalist:[]
			}
		},
		onShow() {
			this.getdata();
		},
		onPullDownRefresh(){
		  uni.stopPullDownRefresh();
		  this.page=1
		  this.datalist=[];
		  this.getdata()
		},
		methods: {
			chexiaofahuo(item){
				var data={}
				data.order_no=item.order_no
				var that=this
				uni.showModal({
					title:"撤销发货",
					content:"发货数据将被清空,确认撤销发货吗?",
					success:function(ret){
						if(ret.confirm){
							uni.showLoading({title: '撤销中...',icon:"none"})
							that.request('/api/duoqudao/chexiao_fahuo', data,"post").then(ret => {
								  uni.hideLoading()
								  uni.showToast({ title:ret.data.message,icon:"none"})
								  if(ret.data.code == 2){
									setTimeout(function(){
									  that.getdata()
									},3000)
								  }
							})
						}
					}
				})
			},
			 getdata(){
				  var data={}
				  var that=this
				  data.page=this.page
				  data.size=this.size
				  data.goodscode=this.goodscode
				  data.goodsname=this.goodsname
				  data.jxs_code=uni.getStorageSync('fahuo_username').user_code
				  data.role=uni.getStorageSync('fahuo_username').role
				  uni.showLoading({title: '计算中...',icon:"none"})
				  this.request('/api/duoqudao/jxs_product_kucun_chukulog', data,"post").then(ret => {
				  	  uni.hideLoading()
				  	  if(ret.data.length > 0){
				  	   var page=that.page+1
					   that.datalist=ret.data
					   that.page=page
				  	  }
				  })
			},
		}
	}
</script>

<style>
	.weaper{
	  width: calc(100% - 40px);
	  margin: 0 auto;
	}
	.cebtns{
		margin-left: 10px;
		background: red;
		color: #fff;
		border-radius: 50px 20px 20px 50px;
		padding: 0px 12px;
		font-size: 12px;
		height: 21px;
		line-height: 21px;
		margin-top: 4px;
	}
	.frmand{
	  font-size: 14px;
	  margin-top: 20px;
	  background-color: #fff;
	  padding: 10px;
	  border-radius: 5px;
	}
	.lids{
	  border-bottom: 1px solid #eee;
	  padding: 10px;
	  padding-top: 4px;
	}
	.shuyuan{
	  text-align: center;
	  background-color: #1B764A;
	  color: #fff;
	  height: 35px;
	  line-height: 35px;
	  border-radius: 5px;
	  margin-top: 20px;
	}
	.itemna{
	  line-height: 27px;
	  display: flex;
	}
	page{
	  background-color: #eee;
	  padding-bottom: 100px;
	}
	.serarchite{
	  display: flex;
	}
	.inputser{
	  font-size: 14px;
	  height: 32px;
	  line-height: 32px;
	  border: 1px solid #eee;
	  border-radius: 5px;
	  padding-left: 10px;
	}
	.serarchite{
	  margin: 10px 0px;
	}
	.title{
	  font-size: 14px;
	  width: 80px;
	  line-height: 34px;
	}
	.searchbtn{
	  height: 32px;
	  line-height: 32px;
	  background-color: #1B764A;
	  color: #fff;
	  text-align: center;
	  border-radius: 5px;
	  width: 40%;
	  margin: 0 auto;
	  margin-top: 20px;
	  font-size: 14px;
	}
	.w22{
	  width: calc(100% - 100px);
	}
	.w22 input{
	  width: 100%;
	}
	.butomsearch{
	  background-color: #fff;
	  padding: 10px;
	  border-radius: 5px;
	  margin-top: 10px;
	}
	.flex{
	  display: flex;
	}
	.nniui{
	  border-top: 1px solid #eee;
	}
	.cappppca{
	  width:30px;
	  height:30px;
	  margin-left: 10px;
	  margin-top: 2px;
	}
	.butomsearch{
	  background-color: #fff;
	  padding: 10px;
	  border-radius: 5px;
	  margin-top: 10px;
	}
	.nodata{
	  text-align: center;
	  margin-top: 100px;
	  color: #666;
	  font-size: 14px;
	}
	.a1{
	  color: #211e1e;
	}
</style>